import { defineStore } from 'pinia'
import router from "@/router/index.js";

export const useAuthStore = defineStore('auth', {
    state: () => ({
        token: '',
        userInfo: null,
    }),
    actions: {
        setToken(token) {
            this.token = token
        },
        logout() {
            this.token = ''
            router.push('/login')
        }
    },
    persist: true, // 如果你用插件自动持久化
})
